//
// Created by vista on 2017/12/10.
//

#ifndef P_P11_H
#define P_P11_H
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <iostream>
#include <stack>
using namespace std;

class Solution {
public:
    int maxArea(vector<int>& height) {

        auto heightSize = static_cast<int>(height.size());

        int l = 0 ;
        int r = heightSize -1;

        int max = 0;

        while (l < r){

            int tmp = std::min(height[l],height[r]) * (r-l);

            if(max < tmp){
                max = tmp;
            }

            if(height[l] < height[r])
            {
                ++l;
            }else{
                --r;
            }
        }

        return max;
    }
};

#endif //P_P11_H
